

/*
 * Copyright (C) 2015 Jack Jiang(cngeeker.com) The BeautyEye Project. 
 * All rights reserved.
 * Project URL:https://github.com/JackJiang2011/beautyeye
 * Version 3.6
 * 
 * Jack Jiang PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * 
 * TableDemo.java at 2015-2-1 20:25:37, original version by Jack Jiang.
 * You can contact author with jb2011@163.com.
 */

/*
 * @(#)TableDemo.java	1.23 05/11/30
 */



import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.print.PrinterException;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRelation;
import javax.accessibility.AccessibleRelationSet;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.DefaultCellEditor;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSlider;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;

import org.jb2011.lnf.beautyeye.ch3_button.BEButtonUI;
import org.jb2011.lnf.beautyeye.utils.JVM;


import com.star.service.Arrangement;
import com.star.service.MyCombine;
import com.star.service.SureRandom;


// TODO: Auto-generated Javadoc
/**
 * Table demo.
 *
 * @version 1.23 11/30/05
 * @author Philip Milne
 * @author Steve Wilson
 */
public class StarMain extends MainModule {
    
	 JFileChooser fc;
	   /** The jpg icon. */
	    Icon jpgIcon; 
	    
	    /** The gif icon. */
	    Icon gifIcon;
	    /** The dialog. */
	    JDialog dialog; 
	    /** The image. */
	    JLabel theImage; 
	    
	
    /** The table view. */
    JTable      tableView;
    
    /** The scrollpane. */
    JScrollPane scrollpane;
    
    /** The origin. */
    Dimension   origin = new Dimension(0, 0);
    
    /** The is column reordering allowed check box. */
    JCheckBox   isColumnReorderingAllowedCheckBox;
    
    /** The show horizontal lines check box. */
    JCheckBox   showHorizontalLinesCheckBox;
    
    /** The show vertical lines check box. */
    JCheckBox   showVerticalLinesCheckBox;

    /** The is column selection allowed check box. */
    JCheckBox   isColumnSelectionAllowedCheckBox;
    
    /** The is row selection allowed check box. */
    JCheckBox   isRowSelectionAllowedCheckBox;
    //有重码
    JCheckBox   isycm;
    //无三重
    JCheckBox   iswsc;
    //有三重
    JCheckBox   isysm;
    //无三重
    JCheckBox   iswsm;
    //有对数
    JCheckBox   isyds;
    //无对数
    JCheckBox   iswds;
    //有邻数
    JCheckBox   isyls;
    //无邻数
    JCheckBox   iswls;
    //有三邻
    JCheckBox   isysl;
    //无三邻
    JCheckBox   iswsl;
    
    //分离数
    JLabel separationJLabel= new JLabel(getString("StarMain.top.separationJLabel"));
    JTextField separationJTextField=new JTextField("",0);
    //同上数
    JLabel sameJLabel= new JLabel(getString("StarMain.top.sameJLabel"));
    JTextField sameJTextField=new JTextField("",0);;
    
    
    /** The inter cell spacing label. */
    JLabel      interCellSpacingLabel;
    
    /** The row height label. */
    JLabel      rowHeightLabel;

    /** The inter cell spacing slider. */
    JSlider     interCellSpacingSlider;
    
    /** The row height slider. */
    JSlider     rowHeightSlider;

    /** The selection mode combo box. */
    JComboBox	selectionModeComboBox = null;
    
    /** The resize mode combo box. */
    JComboBox	resizeModeComboBox = null;

    /** The header label. */
    JLabel      headerLabel;
    
    /** The footer label. */
    JLabel      footerLabel;

    /** The header text field. */
    JTextField  headerTextField;
    
    /** The footer text field. */
    JTextField  footerTextField;

    /** The fit width. */
    JCheckBox   fitWidth;
    
    /** The print button. */
    JButton     printButton;

    /** The control panel. */
    JPanel      controlPanel;
    
    /** The table aggregate. */
    JScrollPane tableAggregate;

    /** The path. */
    String path = "ImageClub/food/";

    /** The INITIA l_ rowheight. */
    final int INITIAL_ROWHEIGHT = 25;// 原代码是33，由jb2011改为25，好看些

    /*A+B 两数之和*/
    JLabel lAB= new JLabel("A+B");
    JTextField tAB;
    JLabel lAC= new JLabel("A+C");
    JTextField tAC;
    JLabel lAD= new JLabel("A+D");
    JTextField tAD;
    JLabel lBC= new JLabel("B+C");
    JTextField tBC;
    JLabel lBD= new JLabel("B+D");
    JTextField tBD;
    JLabel lCD= new JLabel("C+D");
    JTextField tCD;
    /*A-B 两数之差*/
    JLabel lABAbs= new JLabel("A-B");
    JTextField tABAbs;
    JLabel lACAbs= new JLabel("A-C");
    JTextField tACAbs;
    JLabel lADAbs= new JLabel("A-D");
    JTextField tADAbs;
    JLabel lBCAbs= new JLabel("B-C");
    JTextField tBCAbs;
    JLabel lBDAbs= new JLabel("B-D");
    JTextField tBDAbs;
    JLabel lCDAbs= new JLabel("C-D");
    JTextField tCDAbs;
    
    /*三数和*/
    JLabel lABC= new JLabel("A+B+C");
    JTextField tABC;
    JLabel lABD= new JLabel("A+B+D");
    JTextField tABD;
    JLabel lACD= new JLabel("A+C+D");
    JTextField tACD;
    JLabel lBCD= new JLabel("B+C+D");
    JTextField tBCD;
    
    /*其他绝对值*/
    //两合见数*
    JLabel lLHJSAbs= new JLabel(getString("StarMain.bottom.lLHJSAbs"));
    JTextField tLHJSAbs=new JTextField("",0);
    //两差见数
    JLabel lLCJSAbs= new JLabel(getString("StarMain.bottom.lLCJSAbs"));
    JTextField tCJSAbs=new JTextField("",0);
    //三合见数*
    JLabel lSHJSAbs= new JLabel(getString("StarMain.bottom.lSHJSAbs"));
    JTextField tSHJSAbs=new JTextField("",0);
    //三差见数
    JLabel lSCJSAbs= new JLabel(getString("StarMain.bottom.lSCJSAbs"));
    JTextField tSCJSAbs=new JTextField("",0);
    //两码同合
    JLabel lLMTHAbs= new JLabel(getString("StarMain.bottom.lLMTHAbs"));
    JTextField tLMTHAbs=new JTextField("",0);
    //三码同合
    JLabel lSMTHAbs= new JLabel(getString("StarMain.bottom.lSMTHAbs"));
    JTextField tSMTHAbs=new JTextField("",0);
    //两码同差
    JLabel lLMTCAbs= new JLabel(getString("StarMain.bottom.lLMTCAbs"));
    JTextField tLMTCAbs=new JTextField("",0);
    //三码同差
    JLabel lSMTCAbs= new JLabel(getString("StarMain.bottom.lSMTCAbs"));
    JTextField tSMTCAbs=new JTextField("",0);
    //两码同不合
    JLabel lLMTBHAbs= new JLabel(getString("StarMain.bottom.lLMTBHAbs"));
    JTextField tLMTBHAbs=new JTextField("",0);
    //三码同不合
    JLabel lSMTBHAbs= new JLabel(getString("StarMain.bottom.lSMTBHAbs"));
    JTextField tSMTBHAbs=new JTextField("",0);
    //两码同不差
    JLabel lLMTBCAbs= new JLabel(getString("StarMain.bottom.lLMTBCAbs"));
    JTextField tLMTBCAbs=new JTextField("",0);
    //三码同不差
    JLabel lSMTBCAbs= new JLabel(getString("StarMain.bottom.lSMTBCAbs"));
    JTextField tSMTBCAbs=new JTextField("",0);
    /**
     * 稳见数 左边
     */
    //稳见全数
    JLabel lwqjs= new JLabel(getString("StarMain.bottom.lwqjs"));
    JTextField twjqs;
    
    //稳全排数
    JLabel lwqps= new JLabel(getString("StarMain.bottom.lwqps"));
    JTextField twpps;
    
    //稳上1数
    JLabel lws1s= new JLabel(getString("StarMain.bottom.lws1s"));
    JTextField tws1s=new JTextField("",0);;
    
    //稳排1数
    JLabel lwp1s= new JLabel(getString("StarMain.bottom.lwp1s"));
    JTextField twp1s=new JTextField("",0);
    
    //稳上2数
    JLabel lws2s= new JLabel(getString("StarMain.bottom.lws2s"));
    JTextField tws2s=new JTextField("",0);;
    
    //稳排2数
    JLabel lwp2s= new JLabel(getString("StarMain.bottom.lwp2s"));
    JTextField twp2s;
    
    //稳上1+数
    JLabel lws1js= new JLabel(getString("StarMain.bottom.lws1js"));
    JTextField tws1js=new JTextField("",0);;
    
    //稳排12数
    JLabel lwp12s= new JLabel(getString("StarMain.bottom.lwp12s"));
    JTextField twp12s;
    
    //稳上2+数
    JLabel lws2js= new JLabel(getString("StarMain.bottom.lws2js"));
    JTextField tws2js=new JTextField("",0);;
    
    //稳排2+数
    JLabel lp2js= new JLabel(getString("StarMain.bottom.lp2js"));
    JTextField tp2js;
    
    //稳上12数
    JLabel lws12s= new JLabel(getString("StarMain.bottom.lws12s"));
    JTextField tws12s=new JTextField("",0);;
    //稳排3+数
    JLabel lwp3js= new JLabel(getString("StarMain.bottom.lwp3js"));
    JTextField twp3js;
   
    
    /**
     * 稳见数右边
     */
    //AB见数
    JLabel lABjs= new JLabel(getString("StarMain.bottom.lABjs"));
    JTextField tABjs;
    //AC见数
    JLabel lACjs= new JLabel(getString("StarMain.bottom.lACjs"));
    JTextField tACjs;
    //AD见数
    JLabel lADjs= new JLabel(getString("StarMain.bottom.lADjs"));
    JTextField tADjs;
    //BC见数
    JLabel lBCjs= new JLabel(getString("StarMain.bottom.lBCjs"));
    JTextField tBCjs;
    //BD见数
    JLabel lBDjs= new JLabel(getString("StarMain.bottom.lBDjs"));
    JTextField tBDjs;
    //CD见数
    JLabel lCDjs= new JLabel(getString("StarMain.bottom.lCDjs"));
    JTextField tCDjs;
    //ABC见数
    JLabel lABCjs= new JLabel(getString("StarMain.bottom.lABCjs"));
    JTextField tABCjs;
    //ABD见数
    JLabel lABDjs= new JLabel(getString("StarMain.bottom.lABDjs"));
    JTextField tABDjs;
    //ACD见数
    JLabel lACDjs= new JLabel(getString("StarMain.bottom.lACDjs"));
    JTextField tACDjs;
    //BCD见数
    JLabel lBCDjs= new JLabel(getString("StarMain.bottom.lBCDjs"));
    JTextField tBCDjs;
    
    //------------------------------------值域----------------------------
    //开始值
    JTextField biginValue=new JTextField("",0);
    //至
    JLabel or= new JLabel(getString("StarMain.top.or"));
    //结束值
    JTextField endValue=new JTextField("",0);;
    //总值≠ 
    JLabel lNotTotalvalue= new JLabel(getString("StarMain.top.lNotTotalvalue"));
    JTextField tNotTotalvalue=new JTextField("",0);;
    //总值=
    JLabel ltotalvalue= new JLabel(getString("StarMain.top.ltotalvalue"));
    JTextField ttotalvalue=new JTextField("",0);;
    //四码值=
    JLabel l4Value= new JLabel(getString("StarMain.top.l4Value"));
    JTextField t4Value=new JTextField("",0);;
    //单值
    JCheckBox singularCheckBox=new JCheckBox(getString("StarMain.top.singularCheckBox"), false);
    //双值
    JCheckBox dualCheckBox =new JCheckBox(getString("StarMain.top.dualCheckBox"), false);
    
     
    //A
    JLabel LA= new JLabel(getString("StarMain.top.LA"));
    JCheckBox LA0 =new JCheckBox(getString("StarMain.top.LX0"), false);
    JCheckBox LA1 =new JCheckBox(getString("StarMain.top.LX1"), false);
    JCheckBox LA2 =new JCheckBox(getString("StarMain.top.LX2"), false);
    JCheckBox LA3 =new JCheckBox(getString("StarMain.top.LX3"), false);
    JCheckBox LA4 =new JCheckBox(getString("StarMain.top.LX4"), false);
    JCheckBox LA5 =new JCheckBox(getString("StarMain.top.LX5"), false);
    JCheckBox LA6 =new JCheckBox(getString("StarMain.top.LX6"), false);
    JCheckBox LA7 =new JCheckBox(getString("StarMain.top.LX7"), false);
    JCheckBox LA8 =new JCheckBox(getString("StarMain.top.LX8"), false);
    JCheckBox LA9 =new JCheckBox(getString("StarMain.top.LX9"), false);
    JCheckBox LAS =new JCheckBox(getString("StarMain.top.LXS"), false);
    JCheckBox LAD =new JCheckBox(getString("StarMain.top.LXD"), false);

    //B
    JLabel LB= new JLabel(getString("StarMain.top.LB"));
    JCheckBox LB0 =new JCheckBox(getString("StarMain.top.LX0"), false);
    JCheckBox LB1 =new JCheckBox(getString("StarMain.top.LX1"), false);
    JCheckBox LB2 =new JCheckBox(getString("StarMain.top.LX2"), false);
    JCheckBox LB3 =new JCheckBox(getString("StarMain.top.LX3"), false);
    JCheckBox LB4 =new JCheckBox(getString("StarMain.top.LX4"), false);
    JCheckBox LB5 =new JCheckBox(getString("StarMain.top.LX5"), false);
    JCheckBox LB6 =new JCheckBox(getString("StarMain.top.LX6"), false);
    JCheckBox LB7 =new JCheckBox(getString("StarMain.top.LX7"), false);
    JCheckBox LB8 =new JCheckBox(getString("StarMain.top.LX8"), false);
    JCheckBox LB9 =new JCheckBox(getString("StarMain.top.LX9"), false);
    JCheckBox LBS =new JCheckBox(getString("StarMain.top.LXS"), false);
    JCheckBox LBD =new JCheckBox(getString("StarMain.top.LXD"), false);
    //C
    JLabel LC= new JLabel(getString("StarMain.top.LC"));
    JCheckBox LC0 =new JCheckBox(getString("StarMain.top.LX0"), false);
    JCheckBox LC1 =new JCheckBox(getString("StarMain.top.LX1"), false);
    JCheckBox LC2 =new JCheckBox(getString("StarMain.top.LX2"), false);
    JCheckBox LC3 =new JCheckBox(getString("StarMain.top.LX3"), false);
    JCheckBox LC4 =new JCheckBox(getString("StarMain.top.LX4"), false);
    JCheckBox LC5 =new JCheckBox(getString("StarMain.top.LX5"), false);
    JCheckBox LC6 =new JCheckBox(getString("StarMain.top.LX6"), false);
    JCheckBox LC7 =new JCheckBox(getString("StarMain.top.LX7"), false);
    JCheckBox LC8 =new JCheckBox(getString("StarMain.top.LX8"), false);
    JCheckBox LC9 =new JCheckBox(getString("StarMain.top.LX9"), false);
    JCheckBox LCS =new JCheckBox(getString("StarMain.top.LXS"), false);
    JCheckBox LCD =new JCheckBox(getString("StarMain.top.LXD"), false);
    //D
    JLabel LD= new JLabel(getString("StarMain.top.LD"));
    JCheckBox LD0 =new JCheckBox(getString("StarMain.top.LX0"), false);
    JCheckBox LD1 =new JCheckBox(getString("StarMain.top.LX1"), false);
    JCheckBox LD2 =new JCheckBox(getString("StarMain.top.LX2"), false);
    JCheckBox LD3 =new JCheckBox(getString("StarMain.top.LX3"), false);
    JCheckBox LD4 =new JCheckBox(getString("StarMain.top.LX4"), false);
    JCheckBox LD5 =new JCheckBox(getString("StarMain.top.LX5"), false);
    JCheckBox LD6 =new JCheckBox(getString("StarMain.top.LX6"), false);
    JCheckBox LD7 =new JCheckBox(getString("StarMain.top.LX7"), false);
    JCheckBox LD8 =new JCheckBox(getString("StarMain.top.LX8"), false);
    JCheckBox LD9 =new JCheckBox(getString("StarMain.top.LX9"), false);
    JCheckBox LDS =new JCheckBox(getString("StarMain.top.LXS"), false);
    JCheckBox LDD =new JCheckBox(getString("StarMain.top.LXD"), false);
    
    //必上4粒/不上4粒
    //必上
    JTextField tYes1;
    JTextField tYes2;
    JTextField tYes3;
    JTextField tYes4;
    //不上
    JTextField tNot1;
    JTextField tNot2;
    JTextField tNot3;
    JTextField tNot4;
    JTextField tNot5;
    
    
    
    JTextField res;
    JTextField help;
    
    
    //设定头必上或者排除
    JTextField cjTA=new JTextField("",0);
    JTextField pcTA=new JTextField("",0);
    JTextField cjTB=new JTextField("",0);
    JTextField pcTB=new JTextField("",0);
    JTextField cjTC=new JTextField("",0);
    JTextField pcTC=new JTextField("",0);
    JTextField cjTD=new JTextField("",0);
    JTextField pcTD=new JTextField("",0);
    
    //空格
  
    
    
    public JTextArea demoSrcPane = null;
    
    public FileChooserDemo file;
    /**
     * main method allows us to run as a standalone demo.
     *
     * @param args the arguments
     */
    StringBuffer  sf=new StringBuffer();
    public static void main(String[] args) {
	StarMain demo = new StarMain(null);
	//demo.mainImpl();
    }
    
    /* (non-Javadoc)
     * @see DemoModule#getName()
     */
    @Override public String getName() {
    	return "七星彩缩水";
    };

    /**
     * TableDemo Constructor.
     *
     * @param swingset the swingset
     */
    public StarMain(final SwingSet2 swingset) {
    	
    	
	super(swingset, "TableDemo", "toolbar/JTable.gif");
	
	getDemoPanel().setLayout(new BorderLayout());
	
	controlPanel = new JPanel();
    controlPanel.setLayout(new BoxLayout(controlPanel, BoxLayout.Y_AXIS));//X_AXIS从左到右 Y_AXIS从上到下
    //头部位置
	JPanel cbPanel = new JPanel(new GridLayout(1, 4));
	cbPanel.setLayout(new BoxLayout(cbPanel, BoxLayout.Y_AXIS));
	cbPanel.setBorder(new TitledBorder(getString("StarBar.top")));//引入头部
        JPanel labelPanel = new JPanel(new GridLayout(3, 1)) {
            public Dimension getMaximumSize() {
                return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
            }
        };
   
    JPanel sliderPanel = new JPanel(new GridLayout(2, 1)) {
            public Dimension getMaximumSize() {
                return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
            }
        };
    // sliderPanel.setBorder(new TitledBorder(getString("StarMain.middle")));//引入底部
    //值域
  	JPanel rangePanel = new JPanel(new GridLayout(1, 2));
  	rangePanel.setBorder(new TitledBorder(getString("StarMain.top.rangePanel")));//
  	
  	
  	rangePanel.add(biginValue);
  	rangePanel.add(or);
  	rangePanel.add(endValue);
  	rangePanel.add(lNotTotalvalue);
  	rangePanel.add(tNotTotalvalue);
  	rangePanel.add(ltotalvalue);
  	rangePanel.add(ttotalvalue);
  	rangePanel.add(l4Value);
  	rangePanel.add(t4Value);
  	rangePanel.add(singularCheckBox);
  	rangePanel.add(dualCheckBox);
 
  	

  	//特别筛选
  	JPanel screenPanel = new JPanel(new GridLayout(1, 2));
  	screenPanel.setBorder(new TitledBorder(getString("StarMain.top.screenPanel")));//
  	
  	
    //-------------------------------出局/排除数---------------------------------
  	JPanel excludePanel = new JPanel(new GridLayout());
  	excludePanel.setBorder(new TitledBorder(getString("StarMain.top.excludePanel")));//
  	//excludePanel.setPreferredSize(new Dimension(300, 10));
  	//出局
    JPanel excludeLPanel = new JPanel();
    excludeLPanel.setLayout(new GridLayout(1,2));
    excludeLPanel.setBorder(new TitledBorder(getString("StarMain.top.excludeLPanel")));
    //excludeLPanel.setPreferredSize(new Dimension(3200, 150));

    
  	//排除
   JPanel excludeRPanel = new JPanel();
    excludeRPanel.setLayout(new GridLayout(1,10));//
    excludeRPanel.setBorder(new TitledBorder(getString("StarMain.top.excludeRPanel")));
    //出局
    JPanel cjPanel = new JPanel();
    cjPanel.setLayout(new GridLayout(2,4,0,0));
    cjPanel.setBorder(new TitledBorder(getString("StarMain.middle.YSPanel")));//
    //必上/排除
    JPanel bsSPanel = new JPanel();
    bsSPanel.setLayout(new GridLayout(2,2,0,0));
    bsSPanel.setBorder(new TitledBorder(getString("StarMain.middle.ZHPanel")));//
    excludeLPanel.add(cjPanel);
    //cjPanel.add(LA);
    cjPanel.add( new JLabel(getString("StarMain.top.LA")+getString("StarMain.top.LQW")+getString("StarMain.middle.JLbs")));
    cjPanel.add(cjTA,BorderLayout.EAST);
    cjPanel.setForeground(Color.red);
    //cjPanel.add( new JLabel(getString("StarMain.middle.JLpc")));
    //cjPanel.add(pcTA);
    cjPanel.add( new JLabel(getString("StarMain.top.LB")+getString("StarMain.top.LBW")+getString("StarMain.middle.JLbs")));
    cjPanel.add(cjTB);
    //cjPanel.add( new JLabel(getString("StarMain.middle.JLpc")));
    //cjPanel.add(pcTB);
    cjPanel.add( new JLabel(getString("StarMain.top.LC")+getString("StarMain.top.LSW")+getString("StarMain.middle.JLbs")));
    cjPanel.add(cjTC);
    //cjPanel.add( new JLabel(getString("StarMain.middle.JLpc")));
    //cjPanel.add(pcTC);
    cjPanel.add( new JLabel(getString("StarMain.top.LD")+getString("StarMain.top.LGW")+getString("StarMain.middle.JLbs")));
    cjPanel.add(cjTD);
   // cjPanel.add( new JLabel(getString("StarMain.middle.JLpc")));
   // cjPanel.add(pcTD);
    //组合指定

    bsSPanel.add(  new JLabel(getString("StarMain.middle.AXXD")));
    JTextField cjTAXXD=new JTextField("1xx1",0);
    bsSPanel.add(cjTAXXD);
    bsSPanel.add( new JLabel(getString("StarMain.middle.XBCX")));
    JTextField cjTXBCX=new JTextField("",0);
    bsSPanel.add(cjTXBCX);
    bsSPanel.add( new JLabel(getString("StarMain.middle.ABXX")));
    JTextField cjTABXX=new JTextField("",0);
    bsSPanel.add(cjTABXX);
    
    bsSPanel.add( new JLabel(getString("StarMain.middle.AXCX")));
    JTextField cjTAXCX=new JTextField("",0);
    bsSPanel.add(cjTAXCX);
    
    
    bsSPanel.add( new JLabel(getString("StarMain.middle.XBXD")));
    JTextField cjTXBXD=new JTextField("",0);
    bsSPanel.add(cjTXBXD);
    
    bsSPanel.add( new JLabel(getString("StarMain.middle.XXCD")));
    JTextField cjTXXCD=new JTextField("",0);
    bsSPanel.add(cjTXXCD);
    
    bsSPanel.add( new JLabel(getString("StarMain.middle.ABCX")));
    JTextField cjTABCX=new JTextField("",0);
    bsSPanel.add(cjTABCX);
    
    bsSPanel.add( new JLabel(getString("StarMain.middle.ABXD")));
    JTextField cjABXD=new JTextField("",0);
    bsSPanel.add(cjABXD);
    
    bsSPanel.add( new JLabel(getString("StarMain.middle.AXCD")));
    JTextField cjTAXCD=new JTextField("",0);
    bsSPanel.add(cjTAXCD);
    bsSPanel.add( new JLabel(getString("StarMain.middle.XBCD")));
    JTextField cjTXBCD=new JTextField("",0);
    bsSPanel.add(cjTXBCD);
    bsSPanel.add( new JLabel(getString("StarMain.middle.ABCD")));
    JTextField cjTABCD=new JTextField("",0);
    bsSPanel.add(cjTABCD);
   

    
    //excludeLPanel.add(bsSPanel);
    
    excludePanel.add(excludeLPanel);
    excludePanel.add(excludeRPanel);
    //必上4粒
    JPanel yesSPanel = new JPanel();
    yesSPanel.setLayout(new GridLayout(2,12));
    yesSPanel.setBorder(new TitledBorder(getString("StarMain.middle.yesSPanel")));//
    //不上4粒--已经完成
    JPanel notSPanel = new JPanel();
    notSPanel.setLayout(new GridLayout(2,12));
    notSPanel.setBorder(new TitledBorder(getString("StarMain.middle.notSPanel")));//
   // excludeRPanel.add(yesSPanel);
    excludeRPanel.add(notSPanel);
    tYes1=new JTextField("",0);
    tYes2=new JTextField("",0);
    tYes3=new JTextField("",0);
    tYes4=new JTextField("",0);
    yesSPanel.add(tYes1);
    yesSPanel.add(tYes2);
    yesSPanel.add(tYes3);
    yesSPanel.add(tYes4);
    tNot1=new JTextField("",0);
    tNot2=new JTextField("",0);
    tNot3=new JTextField("",0);
    tNot4=new JTextField("",0);
    tNot5=new JTextField("",0);
    notSPanel.add(tNot1);
    notSPanel.add(tNot2);
    notSPanel.add(tNot3);
    notSPanel.add(tNot4);
    notSPanel.add(tNot5);
    //稳上指定数
    
  	//------------------------------分离数----------------------------------
  	JPanel separationPanel = new JPanel(new GridLayout(1, 2));
  	separationPanel.setBorder(new TitledBorder(getString("StarMain.top.separationPanel")));//
    
  	//cbPanel.add(rangePanel);//去掉值域
  	//cbPanel.add(screenPanel);//去掉特别
  	cbPanel.add(excludePanel);
  	cbPanel.add(separationPanel);
        
        
        
    //两数绝对值
	JPanel comboPanel = new JPanel(new GridLayout(1, 2));
	comboPanel.setBorder(new TitledBorder(getString("StarMain.middle")));//
	//其他绝对值

	JPanel otherABsPanel = new JPanel(new GridLayout(1, 4));
	otherABsPanel.setBorder(new TitledBorder(getString("StarMain.middle.otherABsPanel")));//   
    //tLHJSAbs=new JTextField("",0);
    otherABsPanel.add(lLHJSAbs);
    otherABsPanel.add(tLHJSAbs);
    
    
   /* otherABsPanel.add(lLCJSAbs);
    otherABsPanel.add(tCJSAbs);*/
    
    
    otherABsPanel.add(lSHJSAbs);
    otherABsPanel.add(tSHJSAbs);
    
    /*otherABsPanel.add(lSCJSAbs);
    otherABsPanel.add(tSCJSAbs);
    
    otherABsPanel.add(lLMTHAbs);
    otherABsPanel.add(tLMTHAbs);
    
    otherABsPanel.add(lSMTHAbs);
    otherABsPanel.add(tSMTHAbs);
    otherABsPanel.add(lLMTCAbs);
    otherABsPanel.add(tLMTCAbs);
    otherABsPanel.add(lSMTCAbs);
    otherABsPanel.add(tSMTCAbs);
    otherABsPanel.add(lLMTBHAbs);
    otherABsPanel.add(tLMTBHAbs);
    otherABsPanel.add(lSMTBHAbs);
    otherABsPanel.add(tSMTBHAbs);
    otherABsPanel.add(lLMTBCAbs);
    otherABsPanel.add(tLMTBCAbs);
    otherABsPanel.add(lSMTBCAbs);
    otherABsPanel.add(tSMTBCAbs);*/
	//
	
	//尾部--稳见数
    JPanel printPanel = new JPanel(new GridLayout(0, 2));

    //稳上个数
  	JPanel sureRandomPanel = new JPanel(new GridLayout(2, 10));
  	sureRandomPanel.setBorder(new TitledBorder(getString("StarMain.bottom.sureRandomPanel")));//
  	
  	//稳上指定数
  	JPanel sureAppointPanel = new JPanel(new GridLayout(3, 6));
  	sureAppointPanel.setBorder(new TitledBorder(getString("StarMain.bottom.sureAppointPanel")));//
    
    
  	//按钮
  	JPanel buttonPanel = new JPanel(new GridLayout(1, 6));
  	//buttonPanel.setBorder(new TitledBorder(getString("StarMain.bottom.sureAppointPanel")));//
  	buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
  	JButton btn = new JButton("执行缩水");
	btn.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.green));
	btn.setForeground(Color.white);
	res=new JTextField("缩水结果共【00000】组\t\t",0);
	buttonPanel.add(res);
	buttonPanel.add(btn);
	
	JButton btn2 = createPlainFileChooserButton();
	btn2.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.red));
	btn2.setForeground(Color.white);
	buttonPanel.add(btn2);
	
	buttonPanel.add(btn2);
	
	
  	JButton closebtn = new JButton("关闭退出");
  	closebtn.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.green));
  	closebtn.setForeground(Color.white);
	buttonPanel.add(closebtn);
	
	
	help=new JTextField("如有问题请联系Tel:17784682185",0);
	buttonPanel.add(help);
	demoSrcPane = new JTextArea();
	demoSrcPane.setLineWrap(true);
	demoSrcPane.setEditable(false);
	
  	//执行缩水结果
	btn.addActionListener(new ActionListener() {
    	JScrollPane scroller = new JScrollPane();
	    public void actionPerformed(ActionEvent e) {
	    	//全部值码
	    	List<String> fullrs =new ArrayList<String>();
	    	 fullrs=Arrangement.fullrs();
	    	//排除不上4粒的值码
	    	if(!tNot1.getText().isEmpty()){
	    		List<String> rs=MyCombine.rs4(tNot1.getText());
	    		fullrs.removeAll(rs);
	    	}
	    	if(!tNot2.getText().isEmpty()){
	    		List<String> rs=MyCombine.rs4(tNot2.getText());
	    		fullrs.removeAll(rs);
	    	}
	    	if(!tNot3.getText().isEmpty()){
	    		List<String> rs=MyCombine.rs4(tNot3.getText());
	    		fullrs.removeAll(rs);
	    	}
	    	if(!tNot4.getText().isEmpty()){
	    		List<String> rs=MyCombine.rs4(tNot4.getText());
	    		fullrs.removeAll(rs);
	    	}
	    	if(!tNot5.getText().isEmpty()){
	    		List<String> rs=MyCombine.rs4(tNot5.getText());
	    		fullrs.removeAll(rs);
	    	}
	    	//稳上指定数
	    	//AB见数
	    	if(!tABjs.getText().isEmpty()){
				Iterator <String> it = fullrs.iterator();  
				fullrs=new ArrayList<String>();
				while(it.hasNext())  
				{  
					String s=it.next();
				    if(s.matches("["+tABjs.getText()+"][\\d][\\d][\\d]")||s.matches("[\\d]["+tABjs.getText()+"][\\d][\\d]"))  
				    {  
				    	fullrs.add(s);
				    }  
				} 
	    	}
	    	//AC见数
	    	if(!tACjs.getText().isEmpty()){Iterator <String> it = fullrs.iterator();  fullrs=new ArrayList<String>();
	    		while(it.hasNext()){ String s=it.next();if(s.matches("["+tACjs.getText()+"][\\d][\\d][\\d]")||s.matches("[\\d][\\d]["+tACjs.getText()+"][\\d]"))  
	    			{ 	fullrs.add(s);}  
	    		} 
	    	}
	    	//AD见数
	    	if(!tADjs.getText().isEmpty()){Iterator <String> it = fullrs.iterator();fullrs=new ArrayList<String>();
	    		while(it.hasNext()) { String s=it.next();if(s.matches("["+tADjs.getText()+"][\\d][\\d][\\d]")||s.matches("[\\d][\\d][\\d]["+tADjs.getText()+"]"))  
	    			{fullrs.add(s);}  
	    		} 
	    	}
	    	//BC见数
	    	if(!tBCjs.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    		while(it.hasNext())  { String s=it.next();if(s.matches("[\\d]["+tBCjs.getText()+"][\\d][\\d]")||s.matches("[\\d][\\d]["+tBCjs.getText()+"][\\d]"))  
	    			{ 	fullrs.add(s);}  
	    		} 
	    	}
	    	//BD见数
	    	if(!tBDjs.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("[\\d]["+tBDjs.getText()+"][\\d][\\d]")||s.matches("[\\d][\\d][\\d]["+tBDjs.getText()+"]"))  
	    			{ 	fullrs.add(s);}  
	    		} 
	    	}
	    	//CD见数
	    	if(!tCDjs.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("[\\d][\\d]["+tCDjs.getText()+"][\\d]")||s.matches("[\\d][\\d][\\d]["+tCDjs.getText()+"]"))  
	    			{ 	fullrs.add(s);}  
	    		} 
	    	}
	    	
	    	//ABC见数
	    	if(!tABCjs.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("["+tABCjs.getText()+"][\\d][\\d][\\d]")||s.matches("[\\d]["+tABCjs.getText()+"][\\d][\\d]")||s.matches("[\\d][\\d]["+tABCjs.getText()+"][\\d]"))  
	    	{ 	fullrs.add(s);}  
	    	} 
	    	}
	    	
	    	//ABD见数
	    	if(!tABDjs.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("["+tABDjs.getText()+"][\\d][\\d][\\d]")||s.matches("[\\d]["+tABDjs.getText()+"][\\d][\\d]")||s.matches("[\\d][\\d][\\d]["+tABDjs.getText()+"]"))  
	    	{ 	fullrs.add(s);}  
	    	} 
	    	}
	    	
	    	//BCD见数
	    	if(!tBCDjs.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("[\\d]["+tBCDjs.getText()+"][\\d][\\d]")||s.matches("[\\d][\\d]["+tBCDjs.getText()+"][\\d]")||s.matches("[\\d][\\d][\\d]["+tBCDjs.getText()+"]"))  
	    	{ 	fullrs.add(s);}  
	    	} 
	    	}
	    	
	    	//稳见全数
	    	if(!twjqs.getText().isEmpty()){
	    		if(twjqs.getText().length()>4){
	    			//return;
	    		}
	    		Iterator <String> it = fullrs.iterator();
	    		fullrs=new ArrayList<String>();
		    	while(it.hasNext())  { 
		    		String s=it.next();
		    		Pattern p=Pattern.compile("^"+MyCombine.rsSplitF(twjqs.getText(), "(?=.*?A)"));
		        	Matcher m=p.matcher(s);
		        	boolean result=m.find();
		    		if(result)  
			    	{ 	
		    			fullrs.add(s);
		    		}  
			    } 
	    	}
	    	//稳排全数
	    	/*if(!twpps.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	System.out.println(twpps.getText());
	    	while(it.hasNext())  { String s=it.next();
	    	Pattern p=Pattern.compile("["+twpps.getText()+"]");
        	Matcher m=p.matcher(s);
        	boolean result=m.find();
	    	if(!result)  
	    	{ 	fullrs.add(s);}  
	    		
	    	} 
	    	}*/
	    	//稳上1数+
	    	if(!tws1js.getText().isEmpty()){
	    		Iterator <String> it = fullrs.iterator();
	    		fullrs=new ArrayList<String>();
		    	while(it.hasNext())  { 
		    		String s=it.next();
		    		Pattern p=Pattern.compile(MyCombine.rsSplit(tws1js.getText(), "|"));
		        	Matcher m=p.matcher(s);
		        	boolean result=m.find();
		    		if(result)  
			    	{ 	
		    			fullrs.add(s);
		    		}  
			    } 
	    	}
	    	//  稳上1数
	    	if(!tws1s.getText().isEmpty()){
	    		Iterator <String> it = fullrs.iterator();
	    		fullrs=new ArrayList<String>();
		    	while(it.hasNext())  { 
		    		String s=it.next();
		    		if(MyCombine.tws1s(s,tws1s.getText())==1)  
			    	{ 	
		    			fullrs.add(s);
		    		}  
			    } 
	    	}
	    	//稳上2数
	      	if(!tws2s.getText().isEmpty()){
	    		Iterator <String> it = fullrs.iterator();
	    		fullrs=new ArrayList<String>();
		    	while(it.hasNext())  { 
		    		String s=it.next();
		    		if(MyCombine.tws1s(s,tws2s.getText())==2)  
			    	{ 	
		    			fullrs.add(s);
		    		}  
			    } 
	    	}
	    	//稳上2数+
	      	if(!tws2js.getText().isEmpty()){
	    		Iterator <String> it = fullrs.iterator();
	    		fullrs=new ArrayList<String>();
		    	while(it.hasNext())  { 
		    		String s=it.next();
		    		if(MyCombine.tws1s(s,tws2js.getText())>=2)  
			    	{ 	
		    			fullrs.add(s);
		    		}  
			    } 
	    	}
	      	//稳上12数
	     	if(!tws12s.getText().isEmpty()){
	    		Iterator <String> it = fullrs.iterator();
	    		fullrs=new ArrayList<String>();
		    	while(it.hasNext())  { 
		    		String s=it.next();
		    		if((MyCombine.tws1s(s,tws12s.getText())==1|| MyCombine.tws1s(s,tws12s.getText())==2))  
			    	{ 	
		    			fullrs.add(s);
		    		}  
			    } 
	    	}
	    	//头排除和必上
	    	//A必上
	    	if(!cjTA.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("["+cjTA.getText()+"][\\d][\\d][\\d]"))  
	    	{ 	fullrs.add(s);}  
	    	} 
	    	}
	    	//A排除
	    	if(!pcTA.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("[^"+pcTA.getText()+"][\\d][\\d][\\d]"))  
	    	{ 	fullrs.add(s);}  
	    	} 
	    	}
	    	//B必上
	    	if(!cjTB.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("[\\d]["+cjTB.getText()+"][\\d][\\d]"))  
	    	{ 	fullrs.add(s);}  
	    	} 
	    	}
	    	//B排除
	    	if(!pcTB.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("[\\d][^"+pcTB.getText()+"][\\d][\\d]"))  
	    	{ 	fullrs.add(s);}  
	    	} 
	    	}
	    	//C必上
	    	if(!cjTC.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("[\\d][\\d]["+cjTC.getText()+"][\\d]"))  
	    	{ 	fullrs.add(s);}  
	    	} 
	    	}
	    	//C排除
	    	if(!pcTC.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("[\\d][\\d][^"+pcTC.getText()+"][\\d]"))  
	    	{ 	fullrs.add(s);}  
	    	} 
	    	}
	    	//D必上
	    	if(!cjTD.getText().isEmpty()){Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
	    	while(it.hasNext())  { String s=it.next();if(s.matches("[\\d][\\d][\\d]["+cjTD.getText()+"]"))  
	    	{ 	fullrs.add(s);}  
	    	} 
	    	}
	    	//D排除
	    	if(!pcTD.getText().isEmpty()){
	    	Iterator <String> it = fullrs.iterator(); fullrs=new ArrayList<String>();
		    	while(it.hasNext())  { 
		    	String s=it.next();
		    	if(s.matches("[\\d][\\d][\\d][^"+pcTD.getText()+"]"))  
		    		{ 	
		    			fullrs.add(s);
		    		}  
		    	} 
	    	}
	    	
	    	//分离数
	    	if(!separationJTextField.getText().isEmpty()){
	    		String separation[]=separationJTextField.getText().split(",");
	    		for (String string : separation) {
	    			if(string.length()==2){
	    				Iterator <String> it = fullrs.iterator(); 
	    				fullrs=new ArrayList<String>();
	    		    	while(it.hasNext())  { 
	    		    	String s=it.next();
	    		    	char  st[]=string.toCharArray();
	    		    	System.out.println(s.indexOf(st[0])>=0);
	    		    	if(!(s.indexOf(st[0])>=0 && s.indexOf(st[1])>=0))  
	    		    		{ 	
	    		    			fullrs.add(s);
	    		    		}  
	    		    	} 
	    		    	separationJTextField.setForeground(Color.black);
	    			}else{
	    				separationJTextField.setForeground(Color.RED);
	    				return ;
	    			}
				
				}
	    		//separationJTextField.setBackground(Color.red);
	    		
	    	}
	    	//同上数
	    	if(!sameJTextField.getText().isEmpty()){
	    		String separation[]=sameJTextField.getText().split(",");
	    		List<String> fullrsTemp=new ArrayList<String>();
	    		for (String string : separation) {
	    			if(string.length()<=4){
	    				Iterator <String> it = fullrs.iterator(); 
		    		    	while(it.hasNext())  { 
		    		    	String s=it.next();
		    		    /*	char st[]=string.toCharArray();
		    		    	 for (char string2 : st) {
		    		    		 //稳上一数
		    		    		 Pattern p=Pattern.compile(MyCombine.rsSplit(String.valueOf(string2), "|"));
						        	Matcher m=p.matcher(s);
						        	boolean result=m.find();
						    		if(result)  
							    	{ 	//稳上全数
*/						    			Pattern p2=Pattern.compile("^"+MyCombine.rsSplitF(string, "(?=.*?A)"));
							        	Matcher m2=p2.matcher(s);
							        	boolean result2=m2.find();
							        	System.out.println(s+"--"+string+""+result2);
							    		if(result2)  
								    	{ 	
							    			if(!fullrsTemp.contains(s)){
							    				fullrsTemp.add(s);
							    			}
							    			
							    		} 
						    		/*}else{
						    			if(!fullrs.contains(s)){
						    				fullrs.add(s);
						    			}
						    			System.out.println(s);
						    		}*/
							//}
			    		    	
		    		        } 
	    			}else{
	    				separationJTextField.setForeground(Color.RED);
	    				return ;
	    			}
	    		
				}
	    		fullrs =new ArrayList<String>();
    			fullrs=fullrsTemp;
	    		//separationJTextField.setBackground(Color.red);
	    		
	    	}
	    	
	     	//稳排1数
	    	/*if(!twp1s.getText().isEmpty()){
	    		Iterator <String> it = fullrs.iterator();
	    		fullrs=new ArrayList<String>();
	    		while(it.hasNext())  { 
	    			String s=it.next();
	    			
	    			if(SureRandom.lwp1s(twp1s.getText()))  
	    			{ 	
	    				fullrs.add(s);
	    			}  
	    		} 
	    	}*/
	    	
	    	//指定组合
	    	
	    	//两合见数
	    	//tLHJSAbs
	      	if(!tLHJSAbs.getText().isEmpty()){
	    		Iterator <String> it = fullrs.iterator();
	    		fullrs=new ArrayList<String>();
	    		while(it.hasNext())  { 
	    			String s=it.next();
	    			String[] lhjs=tLHJSAbs.getText().split(",");
	    			for (String string : lhjs) {
	    				
	    				if(com.star.service.otherABsPanel.permutation(tLHJSAbs.getText(),s))  
		    			{ 	
		    				fullrs.add(s);
		    			}  
					}
	    			
	    		} 
	    		fullrs=new ArrayList(new HashSet(fullrs));
	    	}
	        System.out.println(iswsc.isSelected());
	        System.out.println("共剩余["+fullrs.size()+"]组值码");
	     /*   StringBuffer bf=new StringBuffer();
	        for (String string : fullrs) {
	        	
	        	sf.append(string+",");
				
			}*/
	        sf= new StringBuffer();
	        int size = fullrs.size();  
	        if (size > 0) {  
	            size--;  
	            for(int i=0; i<size; i++)  {  
	            	sf.append(fullrs.get(i)).append(",");  
	            }  
	            sf.append(fullrs.get(size));  
	        }
	        String str = String.format("%5d", fullrs.size()).replace(" ", "0");
	        res.setText("缩水结果共【"+str+"】组\t\t");
	        demoSrcPane.setText(sf.toString());
	    	
	    	scroller.getViewport().add(demoSrcPane);
	    	swingset.tabbedPane.addTab(
//					getString("TabbedPane.src_label"),
					"缩水结果",
					null,
					scroller,
					"查看缩水结果"
			);
	   
	      loadSourceCode();
	    }
    });
	/*
	 *关闭退出
	 */
	closebtn.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			System.exit(0);
			
		}});
	getDemoPanel().add(controlPanel, BorderLayout.NORTH);
	Vector relatedComponents = new Vector();
        // check box panel
    	isColumnReorderingAllowedCheckBox = new JCheckBox(getString("TableDemo.reordering_allowed"), true);
        isColumnReorderingAllowedCheckBox.addActionListener(new ActionListener() {
	    public void actionPerformed(ActionEvent e) {
	        boolean flag = ((JCheckBox)e.getSource()).isSelected();
                tableView.getTableHeader().setReorderingAllowed(flag);
                tableView.repaint();
	    }
        });

    	showHorizontalLinesCheckBox = new JCheckBox(getString("TableDemo.horz_lines"), true);
        showHorizontalLinesCheckBox.addActionListener(new ActionListener() {
	    public void actionPerformed(ActionEvent e) {
	        boolean flag = ((JCheckBox)e.getSource()).isSelected();
                tableView.setShowHorizontalLines(flag); ;
                tableView.repaint();
	    }
        });

    	showVerticalLinesCheckBox = new JCheckBox(getString("TableDemo.vert_lines"), false);// 原代码默认check是true，现由jb2011改为false
        showVerticalLinesCheckBox.addActionListener(new ActionListener() {
	    public void actionPerformed(ActionEvent e) {
	        boolean flag = ((JCheckBox)e.getSource()).isSelected();
                tableView.setShowVerticalLines(flag); ;
                tableView.repaint();
	    }
        });

        
    
        
	// Show that showHorizontal/Vertical controls are related
	relatedComponents.removeAllElements();
	relatedComponents.add(showHorizontalLinesCheckBox);
	relatedComponents.add(showVerticalLinesCheckBox);
	buildAccessibleGroup(relatedComponents);

        isRowSelectionAllowedCheckBox = new JCheckBox(getString("TableDemo.row_selection"), true);
        isRowSelectionAllowedCheckBox.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                boolean flag = ((JCheckBox)e.getSource()).isSelected();
                tableView.setRowSelectionAllowed(flag); ;
                tableView.repaint();
            }
        });

        isColumnSelectionAllowedCheckBox = new JCheckBox(getString("TableDemo.column_selection"), false);
        isColumnSelectionAllowedCheckBox.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                boolean flag = ((JCheckBox)e.getSource()).isSelected();
                tableView.setColumnSelectionAllowed(flag); ;
                tableView.repaint();
            }
        });

        // Show that row/column selections are related
        relatedComponents.removeAllElements();
        relatedComponents.add(isColumnSelectionAllowedCheckBox);
        relatedComponents.add(isRowSelectionAllowedCheckBox);
        buildAccessibleGroup(relatedComponents);

    /*    screenPanel.add(isColumnReorderingAllowedCheckBox);
        screenPanel.add(isRowSelectionAllowedCheckBox);
        screenPanel.add(showHorizontalLinesCheckBox);
        screenPanel.add(isColumnSelectionAllowedCheckBox);
        screenPanel.add(showVerticalLinesCheckBox);*/
        
        
        isycm=new JCheckBox(getString("StarMain.top.isycm"), false);
        screenPanel.add(isycm);
        iswsc=new JCheckBox(getString("StarMain.top.iswsc"), false);
        screenPanel.add(iswsc);
        isysm=new JCheckBox(getString("StarMain.top.isysm"), false);
        screenPanel.add(isysm);
        iswsm=new JCheckBox(getString("StarMain.top.iswsm"), false);
        screenPanel.add(iswsm);
        isyds=new JCheckBox(getString("StarMain.top.isyds"), false);
        screenPanel.add(isyds);
        iswds=new JCheckBox(getString("StarMain.top.iswds"), false);
        screenPanel.add(iswds);
        isyls=new JCheckBox(getString("StarMain.top.isyls"), false);
        screenPanel.add(isyls);
        iswls=new JCheckBox(getString("StarMain.top.iswls"), false);
        screenPanel.add(iswls);
        isysl=new JCheckBox(getString("StarMain.top.isysl"), false);
        screenPanel.add(isysl);
        iswsl=new JCheckBox(getString("StarMain.top.iswsl"), false);
        screenPanel.add(iswsl);

        
       
        separationPanel.add(separationJLabel);
        separationPanel.add(separationJTextField);
        
        sameJTextField=new JTextField("",0);
        separationPanel.add(sameJLabel);
        separationPanel.add(sameJTextField);

        // label panel
        interCellSpacingLabel = new JLabel(getString("TableDemo.intercell_spacing_colon"));
	labelPanel.add(interCellSpacingLabel);

        rowHeightLabel = new JLabel(getString("TableDemo.row_height_colon"));
        labelPanel.add(rowHeightLabel);


        // slider panel
    	interCellSpacingSlider = new JSlider(JSlider.HORIZONTAL, 0, 10, 0);// 原代码value是1，现由jb2011改为0
	interCellSpacingSlider.getAccessibleContext().setAccessibleName(getString("TableDemo.intercell_spacing"));
	interCellSpacingLabel.setLabelFor(interCellSpacingSlider);
        sliderPanel.add(interCellSpacingSlider);
        interCellSpacingSlider.addChangeListener(new ChangeListener() {
	    public void stateChanged(ChangeEvent e) {
	        int spacing = ((JSlider)e.getSource()).getValue();
                tableView.setIntercellSpacing(new Dimension(spacing, spacing));
                tableView.repaint();
	    }
        });
	
    rowHeightSlider = new JSlider(JSlider.HORIZONTAL, 5, 100, INITIAL_ROWHEIGHT);
    
    //行高
	rowHeightSlider.getAccessibleContext().setAccessibleName(getString("TableDemo.row_height"));
	rowHeightLabel.setLabelFor(rowHeightSlider);
        sliderPanel.add(rowHeightSlider);
        rowHeightSlider.addChangeListener(new ChangeListener() {
	    public void stateChanged(ChangeEvent e) {
	        int height = ((JSlider)e.getSource()).getValue();
                tableView.setRowHeight(height);
                tableView.repaint();
	    }
        });

	// Show that spacing controls are related
	relatedComponents.removeAllElements();
	relatedComponents.add(interCellSpacingSlider);
	relatedComponents.add(rowHeightSlider);
	buildAccessibleGroup(relatedComponents);


        // Create the table.
       /* tableAggregate = createTable();
        //由jb2011加的，目的是让表格的4周有多点空白好看点 START
        JPanel tttp = new JPanel(new BorderLayout());
        
        
        tttp.setBorder(BorderFactory.createEmptyBorder(5, 5, 10, 5));
        tttp.add(tableAggregate, BorderLayout.CENTER);
        // END
        getDemoPanel().add(tttp, BorderLayout.CENTER);*/


        // ComboBox for selection modes.
        //指定和差
	    JPanel twoAbs = new JPanel();
	    twoAbs.setLayout(new GridLayout(2,12));
	    twoAbs.setBorder(new TitledBorder(getString("StarMain.middle.left")));
      	//三数和差
      	JPanel threeAbs = new JPanel();
      	threeAbs.setLayout(new GridLayout(2,4));
      	threeAbs.setBorder(new TitledBorder(getString("StarMain.middle.left")));
     
        //selectMode.setLayout(new BoxLayout(selectMode, BoxLayout.X_AXIS));



        selectionModeComboBox = new JComboBox() {
            public Dimension getMaximumSize() {
                return getPreferredSize();
            }
        };
        selectionModeComboBox.addItem(getString("TableDemo.single"));
        selectionModeComboBox.addItem(getString("TableDemo.one_range"));
        selectionModeComboBox.addItem(getString("TableDemo.multiple_ranges"));
       // selectionModeComboBox.setSelectedIndex(tableView.getSelectionModel().getSelectionMode());
        selectionModeComboBox.addItemListener(new ItemListener() {
	    public void itemStateChanged(ItemEvent e) {
	        JComboBox source = (JComboBox)e.getSource();
                tableView.setSelectionMode(source.getSelectedIndex());
	    }
        });

        //selectMode.add(Box.createHorizontalStrut(2));
	    //selectMode.add(selectionModeComboBox);
       // selectMode.add(Box.createHorizontalGlue());
        comboPanel.add(twoAbs);
        
        tAB=new JTextField("",0);
        twoAbs.add(lAB);
        twoAbs.add(tAB);
        
        tAC=new JTextField("",0);
        twoAbs.add(lAC);
        twoAbs.add(tAC);
        
        tAD=new JTextField("",0);
        twoAbs.add(lAD);
        twoAbs.add(tAD);
        
        tBC=new JTextField("",0);
        twoAbs.add(lBC);
        twoAbs.add(tBC);
        
        tBD=new JTextField("",0);
        twoAbs.add(lBD);
        twoAbs.add(tBD);
        
        tCD=new JTextField("",0);
        twoAbs.add(lCD);
        twoAbs.add(tCD);
        //两数之差Abs
        
        tABAbs=new JTextField("",0);
        twoAbs.add(lABAbs);
        twoAbs.add(tABAbs);
        
        tACAbs=new JTextField("",0);
        twoAbs.add(lACAbs);
        twoAbs.add(tACAbs);
        
        tADAbs=new JTextField("",0);
        twoAbs.add(lADAbs);
        twoAbs.add(tADAbs);
        
        tBCAbs=new JTextField("",0);
        twoAbs.add(lBCAbs);
        twoAbs.add(tBCAbs);
        
        tBDAbs=new JTextField("",0);
        twoAbs.add(lBDAbs);
        twoAbs.add(tBDAbs);
        
        tCDAbs=new JTextField("",0);
        twoAbs.add(lCDAbs);
        twoAbs.add(tCDAbs);
        /**
         * 
         */
        comboPanel.add(threeAbs);
        tABC=new JTextField("",0);
        threeAbs.add(lABC);
        threeAbs.add(tABC);
        
        tABD=new JTextField("",0);
        threeAbs.add(lABD);
        threeAbs.add(tABD);
        
        tACD=new JTextField("",0);
        threeAbs.add(lACD);
        threeAbs.add(tACD);
        
        tBCD=new JTextField("",0);
        threeAbs.add(lBCD);
        threeAbs.add(tBCD);
        //其他绝对值
     
        
        //sureRandomPanel
        JPanel twjqsPanel = new JPanel();
        BoxLayout layout=new BoxLayout(twjqsPanel, BoxLayout.X_AXIS); 
        twjqsPanel.setLayout(layout); 
        twjqs=new JTextField("",0);
        twjqsPanel.add(lwqjs);
        twjqsPanel.add(twjqs);
        //twjqsPanel.add(kg);
        sureRandomPanel.add(twjqsPanel);
      /*  twpps=new JTextField("",0);
        sureRandomPanel.add(lwqps);
        sureRandomPanel.add(twpps);*/
        
     
        JPanel tws1sPanel = new JPanel(new GridLayout(1,2));
        BoxLayout tws1slayout=new BoxLayout(tws1sPanel, BoxLayout.X_AXIS); 
        tws1sPanel.setLayout(tws1slayout); 
        tws1s=new JTextField("",0);
        tws1sPanel.add(lws1s);
        tws1sPanel.add(tws1s);
       // tws1sPanel.add(kg);
        sureRandomPanel.add(tws1sPanel);
       /* twp1s=new JTextField("",0);
        sureRandomPanel.add(lwp1s);
        sureRandomPanel.add(twp1s);*/
        JPanel tws2sPanel = new JPanel(new GridLayout(1,2));
        BoxLayout tws2sLayout=new BoxLayout(tws2sPanel, BoxLayout.X_AXIS); 
        tws2sPanel.setLayout(tws2sLayout); 
        tws2s=new JTextField("",0);
        tws2sPanel.add(lws2s);
        tws2sPanel.add(tws2s);
        sureRandomPanel.add(tws2sPanel);
        /*twp2s=new JTextField("",0);
        sureRandomPanel.add(lwp2s);
        sureRandomPanel.add(twp2s);*/
        JPanel tws1jsPanel = new JPanel(new GridLayout(1,2));
        BoxLayout tws1jsLayout=new BoxLayout(tws1jsPanel, BoxLayout.X_AXIS); 
        tws1jsPanel.setLayout(tws1jsLayout); 
        tws1js=new JTextField("",0);
        tws1jsPanel.add(lws1js);
        tws1jsPanel.add(tws1js);
        //tws1jsPanel.add(kg);
        sureRandomPanel.add(tws1jsPanel);
        /*twp12s=new JTextField("",0);
        sureRandomPanel.add(lwp12s);
        sureRandomPanel.add(twp12s);*/
        JPanel tws2jsPanel = new JPanel(new GridLayout(1,2));
        BoxLayout tws2jsLayout=new BoxLayout(tws2jsPanel, BoxLayout.X_AXIS); 
        tws2jsPanel.setLayout(tws2jsLayout); 
        tws2js=new JTextField("",0);
        tws2jsPanel.add(lws2js);
        tws2jsPanel.add(tws2js);
       // tws2jsPanel.add(kg);
        sureRandomPanel.add(tws2jsPanel);
       /* tp2js=new JTextField("",0);
        sureRandomPanel.add(lp2js);
        sureRandomPanel.add(tp2js);*/
        
        JPanel tws12sPanel = new JPanel(new GridLayout(1,2));
        BoxLayout tws12sLayout=new BoxLayout(tws12sPanel, BoxLayout.X_AXIS); 
        tws12sPanel.setLayout(tws12sLayout); 
        tws12s=new JTextField("",0);
        tws12sPanel.add(lws12s);
        tws12sPanel.add(tws12s);
        sureRandomPanel.add(tws12sPanel);
        
       /* twp3js=new JTextField("",0);
        sureRandomPanel.add(lwp3js);
        sureRandomPanel.add(twp3js);*/
       
        //sureAppointPanel
        tABjs=new JTextField("",0);
        sureAppointPanel.add(lABjs);
        sureAppointPanel.add(tABjs);
        tACjs=new JTextField("",0);
        sureAppointPanel.add(lACjs);
        sureAppointPanel.add(tACjs);
        tADjs=new JTextField("",0);
        sureAppointPanel.add(lADjs);
        sureAppointPanel.add(tADjs);
        tBCjs=new JTextField("",0);
        sureAppointPanel.add(lBCjs);
        sureAppointPanel.add(tBCjs);
        tBDjs=new JTextField("",0);
        sureAppointPanel.add(lBDjs);
        sureAppointPanel.add(tBDjs);
        tCDjs=new JTextField("",0);
        sureAppointPanel.add(lCDjs);
        sureAppointPanel.add(tCDjs);
        tABCjs=new JTextField("",0);
        sureAppointPanel.add(lABCjs);
        sureAppointPanel.add(tABCjs);
        tABDjs=new JTextField("",0);
        sureAppointPanel.add(lABDjs);
        sureAppointPanel.add(tABDjs);
        tBCDjs=new JTextField("",0);
        sureAppointPanel.add(lBCDjs);
        sureAppointPanel.add(tBCDjs);
     
       
        
        // Combo box for table resize mode.
	JPanel resizeMode = new JPanel();
        resizeMode.setLayout(new BoxLayout(resizeMode, BoxLayout.X_AXIS));
 	resizeMode.setBorder(new TitledBorder(getString("TableDemo.autoresize_mode")));


        resizeModeComboBox = new JComboBox() {
            public Dimension getMaximumSize() {
                return getPreferredSize();
            }
        };
        resizeModeComboBox.addItem(getString("TableDemo.off"));
        resizeModeComboBox.addItem(getString("TableDemo.column_boundaries"));
        resizeModeComboBox.addItem(getString("TableDemo.subsequent_columns"));
        resizeModeComboBox.addItem(getString("TableDemo.last_column"));
        resizeModeComboBox.addItem(getString("TableDemo.all_columns"));
      //  resizeModeComboBox.setSelectedIndex(tableView.getAutoResizeMode());
        resizeModeComboBox.addItemListener(new ItemListener() {
	    public void itemStateChanged(ItemEvent e) {
	        JComboBox source = (JComboBox)e.getSource();
                tableView.setAutoResizeMode(source.getSelectedIndex());
	    }
        });

        resizeMode.add(Box.createHorizontalStrut(2));
	    resizeMode.add(resizeModeComboBox);
        resizeMode.add(Box.createHorizontalGlue());
        //comboPanel.add(resizeMode);

        /**
         * 中部控件bigin
         */
 
        // print panel
        //printPanel.setBorder(new TitledBorder(getString("TableDemo.printing")));//引入打印
        //设置xi
        printPanel.setBorder(new TitledBorder(getString("StarMain.bottom")));//引入底部
        printPanel.add(sureAppointPanel);
        printPanel.add(sureRandomPanel);
        headerLabel = new JLabel(getString("TableDemo.header"));
        footerLabel = new JLabel(getString("TableDemo.footer"));
        headerTextField = new JTextField(getString("TableDemo.headerText"), 45);
        footerTextField = new JTextField(getString("TableDemo.footerText"), 45);
        fitWidth = new JCheckBox(getString("TableDemo.fitWidth"), true);
        printButton = new JButton(getString("TableDemo.print"));
        printButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                printTable();
            }
        });

        //printPanel.add(headerLabel);
       // printPanel.add(headerTextField);
        //printPanel.add(footerLabel);
        //printPanel.add(footerTextField);
        
        JPanel buttons = new JPanel();
        buttons.add(fitWidth);
        buttons.add(printButton);

        //printPanel.add(buttons);

        // Show that printing controls are related
        relatedComponents.removeAllElements();
        relatedComponents.add(headerTextField);
        relatedComponents.add(footerTextField);
        relatedComponents.add(printButton);
        buildAccessibleGroup(relatedComponents);

        // wrap up the panels and add them
        JPanel sliderWrapper = new JPanel();
        sliderWrapper.setLayout(new BoxLayout(sliderWrapper, BoxLayout.X_AXIS));
        sliderWrapper.add(labelPanel);
        sliderWrapper.add(sliderPanel);
        sliderWrapper.add(Box.createHorizontalGlue());
        sliderWrapper.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
        
        JPanel leftWrapper = new JPanel();
        leftWrapper.setLayout(new BoxLayout(leftWrapper, BoxLayout.Y_AXIS));
        leftWrapper.add(cbPanel);
       // leftWrapper.add(sliderWrapper);

        // add everything
        controlPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 2, 0));
        controlPanel.add(leftWrapper);
        //controlPanel.add(comboPanel);//指定和差
        controlPanel.add(otherABsPanel);
        controlPanel.add(printPanel);
        controlPanel.add(buttonPanel);//按钮

	    //setTableControllers(); // Set accessibility information

        getDemoPanel().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
            .put(KeyStroke.getKeyStroke("ctrl P"), "print");

        getDemoPanel().getActionMap().put("print", new AbstractAction() {
            public void actionPerformed(ActionEvent ae) {
                printTable();
            }
        });
                
    } // TableDemo()

    /**
     * Sets the Accessibility MEMBER_OF property to denote that
     * these components work together as a group. Each object 
     * is set to be a MEMBER_OF an array that contains all of
     * the objects in the group, including itself.
     *
     * @param components The list of objects that are related
     */
    void buildAccessibleGroup(Vector components) {

	AccessibleContext context = null;
	int numComponents = components.size();
	Object[] group = components.toArray();
	Object object = null;
	for (int i = 0; i < numComponents; ++i) {
	    object = components.elementAt(i);
	    if (object instanceof Accessible) {
	        context = ((Accessible)components.elementAt(i)).
						 getAccessibleContext();
		context.getAccessibleRelationSet().add(
		    new AccessibleRelation(
			AccessibleRelation.MEMBER_OF, group));
	    }
	}
    } // buildAccessibleGroup()

    /**
     * This sets CONTROLLER_FOR on the controls that manipulate the
     * table and CONTROLLED_BY relationships on the table to point
     * back to the controllers.
     */
    private void setTableControllers() {

	// Set up the relationships to show what controls the table
	setAccessibleController(isColumnReorderingAllowedCheckBox, 
				tableAggregate);
	setAccessibleController(showHorizontalLinesCheckBox,
				tableAggregate);
	setAccessibleController(showVerticalLinesCheckBox,
				tableAggregate);
	setAccessibleController(isColumnSelectionAllowedCheckBox,
				tableAggregate);
	setAccessibleController(isRowSelectionAllowedCheckBox,
				tableAggregate);
	setAccessibleController(interCellSpacingSlider,
				tableAggregate);
	setAccessibleController(rowHeightSlider,
				tableAggregate);
	setAccessibleController(selectionModeComboBox,
				tableAggregate);
	setAccessibleController(resizeModeComboBox,
				tableAggregate);
    } // setTableControllers()

    /**
     * Sets up accessibility relationships to denote that one
     * object controls another. The CONTROLLER_FOR property is
     * set on the controller object, and the CONTROLLED_BY
     * property is set on the target object.
     *
     * @param controller the controller
     * @param target the target
     */
    private void setAccessibleController(JComponent controller,
					JComponent target) {
	AccessibleRelationSet controllerRelations = 
	    controller.getAccessibleContext().getAccessibleRelationSet();
	AccessibleRelationSet targetRelations = 
	    target.getAccessibleContext().getAccessibleRelationSet();

	controllerRelations.add(
	    new AccessibleRelation(
		AccessibleRelation.CONTROLLER_FOR, target));
	targetRelations.add(
	    new AccessibleRelation(
		AccessibleRelation.CONTROLLED_BY, controller));
    } // setAccessibleController()


    /**
     * Prints the table.
     */
    private void printTable() {
        MessageFormat headerFmt;
        MessageFormat footerFmt;
        JTable.PrintMode printMode = fitWidth.isSelected() ?
                                     JTable.PrintMode.FIT_WIDTH :
                                     JTable.PrintMode.NORMAL;

        String text;
        text = headerTextField.getText();
        if (text != null && text.length() > 0) {
            headerFmt = new MessageFormat(text);
        } else {
            headerFmt = null;
        }

        text = footerTextField.getText();
        if (text != null && text.length() > 0) {
            footerFmt = new MessageFormat(text);
        } else {
            footerFmt = null;
        }

        try {
            boolean status = tableView.print(printMode, headerFmt, footerFmt);

            if (status) {
                JOptionPane.showMessageDialog(tableView.getParent(),
                                              getString("TableDemo.printingComplete"),
                                              getString("TableDemo.printingResult"),
                                              JOptionPane.INFORMATION_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(tableView.getParent(),
                                              getString("TableDemo.printingCancelled"),
                                              getString("TableDemo.printingResult"),
                                              JOptionPane.INFORMATION_MESSAGE);
            }
        } catch (PrinterException pe) {
            String errorMessage = MessageFormat.format(getString("TableDemo.printingFailed"),
                                                       new Object[] {pe.getMessage()});
            JOptionPane.showMessageDialog(tableView.getParent(),
                                          errorMessage,
                                          getString("TableDemo.printingResult"),
                                          JOptionPane.ERROR_MESSAGE);
        } catch (SecurityException se) {
            String errorMessage = MessageFormat.format(getString("TableDemo.printingFailed"),
                                                       new Object[] {se.getMessage()});
            JOptionPane.showMessageDialog(tableView.getParent(),
                                          errorMessage,
                                          getString("TableDemo.printingResult"),
                                          JOptionPane.ERROR_MESSAGE);
        }
    }

    /**
     * The Class NamedColor.
     */
    class NamedColor extends Color {
	
	/** The name. */
	String name;
	
	/**
	 * Instantiates a new named color.
	 *
	 * @param color the color
	 * @param name the name
	 */
	public NamedColor(Color color, String name) {
	    super(color.getRGB());
	    this.name = name;
	}
	
	/**
	 * Gets the text color.
	 *
	 * @return the text color
	 */
	public Color getTextColor() {
	    int r = getRed();
	    int g = getGreen();
	    int b = getBlue();
	    if(r > 240 || g > 240) {
		return Color.black;
	    } else {
		return Color.white;
	    }
	}
	
	/* (non-Javadoc)
	 * @see java.awt.Color#toString()
	 */
	public String toString() {
	    return name;
	}
    }
        
    /**
     * The Class ColumnLayout.
     */
    class ColumnLayout implements LayoutManager {
	
	/** The x inset. */
	int xInset = 5;
	
	/** The y inset. */
	int yInset = 5;
	
	/** The y gap. */
	int yGap = 2;
	
	/* (non-Javadoc)
	 * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
	 */
	public void addLayoutComponent(String s, Component c) {}
	
	/* (non-Javadoc)
	 * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
	 */
	public void layoutContainer(Container c) {
	    Insets insets = c.getInsets();
	    int height = yInset + insets.top;
	    
	    Component[] children = c.getComponents();
	    Dimension compSize = null;
	    for (int i = 0; i < children.length; i++) {
		compSize = children[i].getPreferredSize();
		children[i].setSize(compSize.width, compSize.height);
		children[i].setLocation( xInset + insets.left, height);
		height += compSize.height + yGap;
	    }
	    
	}
	
	/* (non-Javadoc)
	 * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
	 */
	public Dimension minimumLayoutSize(Container c) {
	    Insets insets = c.getInsets();
	    int height = yInset + insets.top;
	    int width = 0 + insets.left + insets.right;
	    
	    Component[] children = c.getComponents();
	    Dimension compSize = null;
	    for (int i = 0; i < children.length; i++) {
		compSize = children[i].getPreferredSize();
		height += compSize.height + yGap;
		width = Math.max(width, compSize.width + insets.left + insets.right + xInset*2);
	    }
	    height += insets.bottom;
	    return new Dimension( width, height);
	}
	
	/* (non-Javadoc)
	 * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
	 */
	public Dimension preferredLayoutSize(Container c) {
	    return minimumLayoutSize(c);
	}
	
	/* (non-Javadoc)
	 * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
	 */
	public void removeLayoutComponent(Component c) {}
    }
    
    /* (non-Javadoc)
     * @see DemoModule#updateDragEnabled(boolean)
     */
    void updateDragEnabled(boolean dragEnabled) {
        tableView.setDragEnabled(dragEnabled);
        headerTextField.setDragEnabled(dragEnabled);
        footerTextField.setDragEnabled(dragEnabled);
    }
    public void loadSourceCode() {
    	//if(getResourceName() != null) {
    		sourceCode="xx3xxx2333";
    	//}
      }
    //显示无格式文件
    public JButton createPlainFileChooserButton() {
    	Action a = new AbstractAction(getString("FileChooserDemo.custombutton")) {
    	    public void actionPerformed(ActionEvent e) {
    		JFileChooser fc = createFileChooser();
    		TxtFileFilter txtFileFilter = new TxtFileFilter();
       		fc.addChoosableFileFilter(txtFileFilter);
    		int index = fc.showSaveDialog(getDemoPanel());
    		    if (index == JFileChooser.APPROVE_OPTION) {
    		     File f = fc.getSelectedFile();
    		     String fileName = fc.getName(f) + ".txt";
    		    String writePath = fc.getCurrentDirectory().getAbsolutePath() +"\\"+ fileName;
    		    try {
    		    	FileOperation.contentToTxt(writePath,sf.toString());
				} catch (Exception e1) {
					
				}
    		     //程序执行完毕后，出现一个对话框来提示
    		   
    		     //System.exit(0);
    		    }
    	    }
    	};
    	return createButton(a);
    }
  
    public Action createOKAction() {
    	return new AbstractAction(getString("FileChooserDemo.ok")) {
    	    public void actionPerformed(ActionEvent e) {
    	    	
    	     	 String file = fc.getCurrentDirectory().getName();
                 System.out.println("File to open " + file);
    		dialog.dispose();
    		if (!e.getActionCommand().equals(JFileChooser.CANCEL_SELECTION)
    		    && fc.getSelectedFile() != null) {

    		   System.out.println(fc.getSelectedFile().getPath());
    		}
    	    }
    	};
    }
    public JFileChooser createFileChooser() {
	// create a filechooser
	JFileChooser fc = new JFileChooser();
        if (getSwingSet2() != null && getSwingSet2().isDragEnabled()) {
            fc.setDragEnabled(true);
        }
	// set the current directory to be the images directory
    //设置打开的文件目录
	File swingFile = new File("C:/Users/Administrator/Desktop/bzcp.txt");
	if(swingFile.exists()) {
	    fc.setCurrentDirectory(swingFile);
	    fc.setSelectedFile(swingFile);
	}else{
		//设置文件目录
		 swingFile = new File("C:/Users/Administrator/Desktop");
		 fc.setCurrentDirectory(swingFile);
	}
	return fc;
    }
    private javax.swing.filechooser.FileFilter createFileFilter(
            String description, String...extensions) {
        description = createFileNameFilterDescriptionFromExtensions(
                    description, extensions);
        return new FileNameExtensionFilter(description, extensions);
        // return null;//* 由jb2011 20120829修改：为了能兼容在jdk1.5上动行，1.6里才有的FileNameExtensionFilter没法用，这里就去掉吧，反正本程序也仅用于演示
    }
    private String createFileNameFilterDescriptionFromExtensions(
            String description, String[] extensions) {
        String fullDescription = (description == null) ?
                "(" : description + " (";
        // build the description from the extension list
        fullDescription += "." + extensions[0];
        for (int i = 1; i < extensions.length; i++) {
            fullDescription += ", .";
            fullDescription += extensions[i];
        }
        fullDescription += ")";
        return fullDescription;
    }


        /**
         * Creates the cancel action.
         *
         * @return the action
         */
        public Action createCancelAction() {
    	return new AbstractAction(getString("FileChooserDemo.cancel")) {
    	    public void actionPerformed(ActionEvent e) {
    		dialog.dispose();
    	    }
    	};
        }

        /**
         * Creates the find action.
         *
         * @return the action
         */
        public Action createFindAction() {
    	Icon icon = createImageIcon("filechooser/find.gif", getString("FileChooserDemo.find"));
    	return new AbstractAction("", icon) {
    	    public void actionPerformed(ActionEvent e) {
                    String result = JOptionPane.showInputDialog(getDemoPanel(), getString("FileChooserDemo.findquestion"));
    		if (result != null) {
    		    JOptionPane.showMessageDialog(getDemoPanel(), getString("FileChooserDemo.findresponse"));
    		}
    	    }
    	};
        }

        /**
         * Creates the help action.
         *
         * @return the action
         */
        public Action createHelpAction() {
    	Icon icon = createImageIcon("filechooser/help.gif", getString("FileChooserDemo.help"));
    	return new AbstractAction("", icon) {
    	    public void actionPerformed(ActionEvent e) {
    		JOptionPane.showMessageDialog(getDemoPanel(), getString("FileChooserDemo.helptext"));
    	    }
    	};
        }
        public JButton createButton(Action a) {
        	JButton b = new JButton(a) {
        	    public Dimension getMaximumSize() {
        		int width = Short.MAX_VALUE;
        		int height = super.getMaximumSize().height;
        		return new Dimension(width, height);
        	    }
        	};
        	return b;
            }

            /**
             * Creates the image button.
             *
             * @param a the a
             * @return the j button
             */
            public JButton createImageButton(Action a) {
        	JButton b = new JButton(a);
        	b.setMargin(new Insets(0,0,0,0));
        	return b;
            }
            
            public void loadImage(String filename) {
            	theImage.setIcon(new MyImageIcon(filename));
           }
            
            public Action createAboutAction() {
            	return new AbstractAction(getString("FileChooserDemo.about")) {
            	    public void actionPerformed(ActionEvent e) {
            		File file = fc.getSelectedFile();
            		String text;
            		if(file == null) {
            		    text = getString("FileChooserDemo.nofileselected");
            		} else {
            		    text = "<html>" + getString("FileChooserDemo.thefile");
            		    text += "<br><font color=green>" + file.getName() + "</font><br>";
            		    text += getString("FileChooserDemo.isprobably") + "</html>";
            		}
            		JOptionPane.showMessageDialog(getDemoPanel(), text);
            	    }
            	};
                }
            /**
             * The Class MyImageIcon.
             */
            class MyImageIcon extends ImageIcon {
        	
        	/**
        	 * Instantiates a new my image icon.
        	 *
        	 * @param filename the filename
        	 */
        	public MyImageIcon(String filename) {
        	    super(filename);
        	};
        	
        	/* (non-Javadoc)
        	 * @see javax.swing.ImageIcon#paintIcon(java.awt.Component, java.awt.Graphics, int, int)
        	 */
        	public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
        	    g.setColor(Color.white);
        	    g.fillRect(0,0, c.getWidth(), c.getHeight());
        	    if(getImageObserver() == null) {
        		g.drawImage(
        		    getImage(),
        		    c.getWidth()/2 - getIconWidth()/2,
        		    c.getHeight()/2 - getIconHeight()/2,
        		    c
        		);
        	    } else {
        		g.drawImage(
        		    getImage(),
        		    c.getWidth()/2 - getIconWidth()/2,
        		    c.getHeight()/2 - getIconHeight()/2,
        		    getImageObserver()
        		);
        	    }
        	}
            }       
           class TxtFileFilter extends FileFilter {
            	 @Override
            	 public boolean accept(File f) {
            	  // TODO Auto-generated method stub
            	  String nameString = f.getName();
            	  return nameString.toLowerCase().endsWith(".txt");
            	 }
            	 @Override
            	 public String getDescription() {
            	  // TODO Auto-generated method stub
            	  return "*.txt(文本文件)";
            	 }
            	 
           }
}
